<?php

namespace App\Http\Controllers;

use DB;
use Illuminate\Http\Request;

use App\Http\Controllers\Controller;
use App\Libs\File;


class TestController extends Controller {

    public function test() {
        $users = DB::select('select * from item where id = ?', [1]);
        return view('welcome2')->with('name', $users);
    }

    public function getIndex() {
        return view("fileupload");
    }
    
    public function postUpload(Request $request){
        // 数据库里面保存$fileUrl的值就行
        $fileUrl = File::uploadIconFile($request->file('uploadfile')) ;
        $fileUrl2 = File::uploadIconFile($request->file('uploadfile2')) ;
        $fullPath = implode('/', [File::getImgsFolder() , $fileUrl]);
        $fullPath2 = implode('/', [File::getImgsFolder() , $fileUrl2]);
        var_dump($fullPath);
        var_dump($fullPath2);
        die('2');
//        File::getImgsFolder() . '/' . $fileUrl;
        dd($fullPath);
    }
    
    public function getQa() {
        $datas = [];
        $datas["deviceid"] = "test";
        $datas["disvantages"] = "text";
        $datas["advantages"] = "text";
        $datas["height"] = "text";
        $datas["weight"] = "text";
        $datas["facetype"] = "text";
        $datas["faceclor"] = "text";
        $datas["situation"] = "text";
        $datas["trystyle"] = "text";
        return $datas;
    }
    
    

}
